package com.woniuxy.userassembly.controller;

import com.woniu.cloud.api.complaint.ComplaintApi;
import com.woniu.cloud.common.dto.Result;
import com.woniu.cloud.entity.TStoreReviews;
import com.woniu.cloud.form.InsertCommentForm;
import com.woniu.cloud.form.InsertComplaintForm;
import com.woniu.cloud.form.SelectCommentForm;
import com.woniuxy.api.CommentApi;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @description: 评论api实现类
 * @author: ZXG
 * @time: 2021/9/23
 */
@RestController
@Api(tags = "用户评论管理", description = "提供用户相关的 API")
public class CommentApiImp implements CommentApi {

    @Resource
    private com.woniu.cloud.CommentApi commentApi;

    @Resource
    private ComplaintApi complaintApi;

    @PostMapping("/insertReviews")
    @ApiOperation("新增评论接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "StoreReviews", value = "新增评论参数", dataType = "InsertCommentForm")
    })
    @ApiResponses({@ApiResponse(code = 200, message = "OK", response = Boolean.class)})
    @Override
    public Result insertReviews(InsertCommentForm StoreReviews) {

        return commentApi.insertStoreReviews(StoreReviews);
    }

    @GetMapping("/getStoreReviewsList")
    @ApiOperation("用户查询评论接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "selectCommentForm", value = "查询条件", dataType = "selectCommentForm"),

    })
    @ApiResponses({@ApiResponse(code = 200, message = "OK", response = TStoreReviews.class)})
    @Override
    public Result getStoreReviewsList(SelectCommentForm selectCommentForm) {
        return  commentApi.getStoreReviewsByStoreReviewsStoreId(selectCommentForm);
    }




    @DeleteMapping("/deleteReview")
    @ApiOperation("删除评论接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "storeReviewId", value = "评论id", dataType = "Integer"),
    })
    @ApiResponses({@ApiResponse(code = 200, message = "OK", response = Boolean.class)})
    @Override
    public Result deleteReview(Integer storeReviewsId) {
       return commentApi.deleteStoreReviewsByStoreReviewsId(storeReviewsId);
    }


    @PostMapping("/insertComplaint")
    @ApiOperation("新增投诉接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "form", value = "新增投诉参数", dataType = "form"),
    })
    @ApiResponses({@ApiResponse(code = 200, message = "OK", response = Boolean.class)})
    @Override
    public Result insertComplaint(InsertComplaintForm form) {
        return complaintApi.insertComplaint(form);
    }







}
